<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('rd_alarm_warn_record', function (Blueprint $table) {
            $table->comment('报警记录');
            $table->bigIncrements('id');
            $table->unsignedBigInteger('broadcast_id')->comment('广播记录id');
            $table->unsignedBigInteger('msg_id')->comment('消息记录id');
            $table->unsignedBigInteger('rod_id')->comment('装置id');
            $table->unsignedBigInteger('stand_id')->comment('站点id');
            $table->unsignedInteger('type')->comment('事件id');
            $table->unsignedTinyInteger('work_id')->nullable()->comment('工单id');
            $table->timestamp('warning_time')->comment('报警时间');
            $table->unsignedBigInteger('device_id')->comment('报警设备id');
            $table->unsignedTinyInteger('risk_level')->comment('风险等级');
            $table->string('title', 255)->comment('标题');
            $table->text('content')->nullable()->comment('内容');
            $table->unsignedTinyInteger('msg_type')->comment('消息类型1雷达2相机');
            $table->timestamps();
            $table->index('stand_id', 'idx_stand_id');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('rd_alarm_warn_record');
    }
};